/*
	2018-7-1 miaov

	npm init -y 初始化 项目， -y 取默认值

	webpack 会自动转换 import 和 export
*/

const path = require('path');
const cleanWebpackPlugin = require('clean-webpack-plugin');
const htmlWebpackPlugin = require('html-webpack-plugin');

function resolve( ...dirs ){
	if( dirs.length == 1 ){
		return path.resolve( __dirname, dirs[0] );
	}else{
		return dirs.map( (item) => path.resolve( __dirname, item ))
	}
}

module.exports = {
	entry : resolve('3/src/app.js'),
	output : {
		path : resolve('3/dist'), // 打包后的文件路径
		filename : 'js/[name].js',
	},
	plugins : [
		new cleanWebpackPlugin([resolve('3/dist/')]),
		new htmlWebpackPlugin()
	]
}